
//路由表的显示文件
import React, { Suspense } from 'react';

import { Switch, Redirect, Route } from 'react-router-dom';

const test = (props) => (
    <Suspense fallback={<div>Loading......</div>}>
        <Switch>
            {
                props.routes.map((item, key) => {
                    if (item.to) return <Redirect key={key} from={item.from} to={item.to} />
                    return <Route key={key} path={item.path} render={routes=> <item.component {...routes} routers={item.children} />} />
                })
            }
        </Switch>
    </Suspense>
)

export default test;